import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import BackHome from '../views/Back/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: 'start',
        name: 'start',
        component: () => import('../views/StartView.vue')
      },
      {
        path: 'class',
        name: 'class',
        component: () => import('../views/ClassView.vue')
      },
      {
        path: 'classAnd',
        name: 'classAnd',
        component: () => import('../views/ClassAnd.vue')
      },
      {
        path: 'label',
        name: 'label',
        component: () => import('../views/LabelView.vue')
      },
      {
        path: 'archive',
        name: 'archive',
        component: () => import('../views/ArchiveView.vue')
      },
      {
        path: 'detail',
        name: 'detail',
        component: () => import('../views/DetailView.vue')
      },

    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/backHome',
    name: 'backHome',
    component:BackHome,
    // component: () => import('../views/Back/HomeView.vue'),
    children: [
      {
        path: 'panel',
        name: 'panel',
        component: () => import('../views/Back/PanelView.vue')
      },
      {
        path: 'article',
        name: 'article',
        component: () => import('../views/Back/ArticleView.vue')
      },
      {
        path: 'category',
        name: 'category',
        component: () => import('../views/Back/CategoryView.vue')
      },
      {
        path: 'tag',
        name: 'tag',
        component: () => import('../views/Back/TagView.vue')
      },
      {
        path: 'settings',
        name: 'settings',
        component: () => import('../views/Back/SettingsView.vue')
      },
      {
        path: 'MySearch',
        name: 'MySearch',
        component: () => import('../components/SearchView.vue')
      },
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
